﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Linq.Expressions;
using FastReflection;

namespace QuickTest
{
    class Program
    {
        static void Main(string[] args)
        {
            var property = typeof(Employee).GetProperty("Name");
            var ageProperty = typeof(Employee).GetProperty("Age");
            Employee e = new Employee { Age = 5 };
            var name = property.ToFastProperty();
            var nameAlt = property.ToFastProperty<Employee, string>();
            FastProperty<Employee, int?> age = FastProperty<Employee, int?>.Make(ageProperty);
            var ageMethod = ageProperty.GetSetMethod();

            for (int o = 0; o < 10; o++)
            {
                DateTime start = DateTime.Now;
                for (int i = 0; i < 10000000; i++)
                {
                    //string nameVal = name.Get(e) as string;
                    //string nameAltVal = nameAlt.Get(e);
                    //string nameVal = e.Name;
                    //name.Set(e, "Jay");
                    age.Set(e, i);
                    //e.Age = i;
                    //ageMethod.Invoke(e, new object[] { i });
                }
                DateTime end = DateTime.Now;

                Console.WriteLine((end - start).TotalMilliseconds);
            }
            Console.Read();
        }
    }
}
